<?php
include("../includes/dbconnection.php");
require_once 'Excel/reader.php';
$data = new Spreadsheet_Excel_Reader();

$data->read('kenya.xls');

error_reporting(E_ALL ^ E_NOTICE);
echo $data->sheets[0]['numRows'];
for ($j = 1; $j <= $data->sheets[0]['numRows']; $j++)
{
	$str = "insert into site_directory set BusinessName='".$data->sheets[0]['cells'][$j+1][2]."',";
	$str.="Location='".$data->sheets[0]['cells'][$j+1][5]."',URL='".$data->sheets[0]['cells'][$j+1][10]."',";
	$str.="ContactEmail='".$data->sheets[0]['cells'][$j+1][9]."',Address1='".$data->sheets[0]['cells'][$j+1][3]."',";
	$str.="City='".$data->sheets[0]['cells'][$j+1][4]."',";
	$str.="Postcode='".$data->sheets[0]['cells'][$j+1][6]."',";
	$str.="Phone='".$data->sheets[0]['cells'][$j+1][7]."',Fax='".$data->sheets[0]['cells'][$j+1][8]."',";
	$str.="InsertedDate='".date("Y-m-d H:i:s")."',ApprovedDate='".date("Y-m-d H:i:s")."',Status=1";
	echo $str."<br>";
	if($data->sheets[0]['cells'][$j+1][1]!="")
	{
		//$exe = mysql_query($str);
	}
}
?>
